<?php

function genlinktacpham($matp) {
    echo base_url("index.php/product/detail?matp=" . $matp);
}

function genlinktacgia($matg, $tentg) {
    echo "Tác giả: <a href='" . base_url('index.php/tacgia/?matg=' . $matg) . "'>  $tentg </a>";
}

function genlinknxb($manxb, $tennxb) {
    echo "Nhà xuất bản: <a href='" . base_url('index.php/nxb/?manxb=' . $manxb) . "'>  $tennxb </a>";
}
?>
<div id="container-wrapper">
    <div id="container1">
        <div class="wrapper-inner">
            <div class="left-70" >                                                    
                <div class="wrapper-row">

                    <!--                -->

                    <!-- hien thi danh sach san pham :3 san pham / 1 hang -->
                    <?php
                    // var_dump($tacgias);
                    $count = 1;
                    echo "<div class='row '>";
                    ?><div class="muc line-height33"> Chuyen muc</div>
                    <?php
                    $x = 1;
                    foreach ($products as $row) {
                        $hinhanh = $row['HINHANH'];
                        $giaban = $row["GIABAN"];
                        $matp = $row["MATP"];
                        ?>
                        <figure class="span4 s-product">
                            <div class="s-product-img">
                                <a href="<?php genlinktacpham($matp); ?> ">
                                    <img src="<?= base_url("public/tacpham/" . $hinhanh); ?>" alt=""></img>
                                </a>

                            </div>
                            <article class="s-product-det">
                                <h3><a href="<? genlinktacpham($matp) ?>">MãTP: <span class="matp"><?= $row['MATP'] ?></span><span class="tentp">  <?= $row['TENTP']; ?></span> </a></h3>
                                <!--<div class="caption"> <p></p> </div>-->
                                <div class="tacgia"> <p><?php genlinktacgia($tacgias[$x]["MATG"], $tacgias[$x]['TENTG']); ?></p> </div>
                                <div class="nxb"> <p><?php genlinknxb($nxbs[$x]["MANXB"], $nxbs[$x]['TENNXB']); ?></p> </div>
                                <div class="cart-price">
                                    <span href="#" class="cart-btn2  add_to_cart"></span>
                                    <span class="price"><?= $giaban; ?></span>
                                </div>
                            </article>

                        </figure>
                        <?php
                        $x+=1;
                    }
                    ?>
                    </div>             
                    <!--end section row -->


                    <!-- ----->
                </div>
                <div class="wrapper-row">
                    <div class="muc line-height33">Gioi thieu ve sach </div>
                    <div class="ct_caption">

                    </div>

                </div>
            </div>
            <div class="right-27">
                <div class="wrapper-row">
                    <div class="muc line-height33"> Chuyen muc</div>
                    <div>

                        <ul>
                            <li>Sách giáo khoa</li>
                            <li>Sách văn học</li>
                            <li>Tiểu thuyết</li>
                            <li>Sách chính trị</li>
                        </ul>

                    </div>
                </div>

                <div class="wrapper-row">
                    <div class="muc line-height33"> Sach cung tac gia</div>
                    <div>
                        <pre>















                        </pre>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</div>
